[300分]急求C语言原程序!!

来源:百度知道 编辑:UC知道 时间:2024/05/21 07:08:12
本来是C语言试题,实在不会做了,就请教各位大人了!300分相送!把原代码发到我的邮箱里
wt_1988114@hotmail.com
就可以了,然后在这里留个帖子,我先送100分,然后再补200。鞠躬+跪地感谢!!
===============================
结构体和结构体指针
一、编写一个表示平面直角坐标系上点的结构体,并写出输入输出函数。程序例子如下:
#include <stdio.h>
struct point
{
float x;
float y;
};
get_point(struct point *p)
{
float a,b;
scanf("%f,%f",&a,&b);
p->x=a;
p->y=b;
return 0;
}
put_point(struct point a)
{
printf("%f,%f\n",a.x,a.y);
return 0;
}
main()
{
struct point a;
printf("Please input a point:");
get_point(&a);
printf("The Point you input is: ");
put_point(a);
}
输入并调试上面程序。
二、编写两个点(矢量)加、减的函数,并进行调试。函数形式如下:
struct point add(struct point a,struct point b)
{
struct point c;
… …
return c;
}
struct point sub(struct point a,

#include <stdio.h>
#include <math.h>

struct point
{
float x;
float y;
};

get_point(struct point *p)
{
float a,b;
scanf("%f,%f",&a,&b);
p->x=a;
p->y=b;
return 0;
}

put_point(struct point a)
{
printf("%f,%f\n",a.x,a.y);
return 0;
}

struct point add(struct point a,struct point b)
{
struct point c;
c.x=a.x+b.x;
c.y=a.y+b.y;
return c;
}

struct point sub(struct point a,struct point b)
{
struct point c;
c.x=a.x-b.x;
c.y=a.y-b.y;
return c;
}

float triangle(struct point A, struct point B, struct point C)
{
float a,b,c,p,area;
struct point d,e,f;
d=sub(A,B);
e=sub(A,C);
f=sub(B,C);

c=sqrt(d.x*d.x+d.y*d.y);
b=sqrt(e.x*e.x+e.y*e.y);
a=sqrt(f.x*f.x+f.y*f.y);

p=(